<div class="SipeiInfo border_3 pb20 centered back_bgf"><!--选修课等级分数设置-弹窗-编辑-->    
    <?php
    $form = $this->beginWidget('CActiveForm', array(
    'action' => Yii::app()->createUrl($this->route),
    'method' => 'POST',
    'id' => 'searchForm',
    'htmlOptions'=>array('target'=>'ajax-frame')
    ));
	?>
        <table class="fontc_666 height32">
            <tbody>
                <tr>
                    <td width="145" align="right" class="pt20 pr5 pb20"><span class="pr5 fontc_orange_red">*</span>考试项目：</td>
                    <td width="350" class="pt20 pb20">            
                        <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                            <span class="fl select_shelter">
                                <select class="fl fontc_666" name="info[exam_id]" onchange="getSubject(this.value)">
                                    <?php if(!empty($info['exam'])): ?>
                                    <?php foreach($info['exam'] as $gv): ?>
                                    <option value="<?php echo $gv['exam_id'] ?>"><?php echo $gv['exam_term_name'] ?></option>
                                    <?php endforeach; ?>
                                    <?php endif; ?>                                
                                </select>
                            </span>
                        </span>
                    </td>
                </tr>
                <tr height="55">
                    <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>所属科目：</td>
                    <td valign="top">
                        <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                            <span class="fl select_shelter">
                                <select class="fl fontc_666" name="info[subject_id]" id="subject">
                                   <option>请选择</option>
                                </select>
                            </span>
                        </span>
                        <div class="formValidator_tip">
                            <p id="subjectTip" ></p>
                        </div>
                    </td>
                </tr>
                <tr height="55">
                    <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>等级：</td>
                    <td valign="top">  
                        <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                            <span class="fl select_shelter">
                                <select class="fl fontc_666" name="info[grading_id]">
                                    <?php if(!empty($info['grading'])): ?>
                                    <?php foreach($info['grading'] as $gv): ?>
                                    <option value="<?php echo $gv['id'] ?>">
                                        <?php echo $gv['grading_name'] ?>
                                    </option>
                                        <?php endforeach; ?>
                                        <?php endif; ?>
                                </select>
                            </span>
                        </span>
                    </td>
                </tr>
                <tr height="60">
                    <td valign="top" align="right" valign="top" class="pr5"><span class="pr5 fontc_orange_red">*</span>分数：</td>
                    <td valign="top" class="formValidator_td">
                    	<input type="text" name="info[score]" id="score" value="" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666">
                    	<div class="formValidator_tip">
                            <p id="scoreTip" ></p>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="right" class="pr2 pb20"></td>
                    <td class="pb20">
                        <input type="submit" value="保存" name="submit" class="cursor b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 mr10">
                        <input type="button" value="取消" onClick="api.close()" class="cursor b_a_n border_3 back_bgb w80 height32 fontc_FFF fonts_12">
                    </td>
                </tr>
            </tbody>
        </table>
<?php
$this->endWidget();
?>
</div>
<iframe src='' style="display:none" name='ajax-frame'></iframe>
<script>
$(function(){
	$.formValidator.initConfig({formID:"searchForm",theme:"126",submitOnce:false,
	onError:function(msg,obj,errorlist){
		$("#errorlist").empty();
		$.map(errorlist,function(msg){
			$("#errorlist").append("<li>" + msg + "</li>")
		});
		alert(msg);
	}
	});
	
	/*分数段规则验证*/
	$("#subject").formValidator({
		onShowText:"",
		onShow:"",
		onFocus:""
	}).inputValidator({
		min:1,
		onError:"请选择科目"
	});

	/*下限分数验证*/
	$("#score").formValidator({
		onShowText:"请输入下线分数",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		max:3,
		onError:"下线分数长度在1-3之间的正整数"
	}).regexValidator({
		regExp: "intege1",
		dataType: "enum",
		onError: "下线分数格式不正确"
	});
	getSubject(<?php echo isset($info['exam'][0]['exam_id'])?$info['exam'][0]['exam_id']:''; ?>);
})

function getSubject(id){
	$.get("/grading/default/get_subject",{id:id},function(data){
				if(data != ''){
					$("#subject").html(data);
				}
				
		})
}
</script>
<?php exit; ?>